﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Messages
{
    public partial class frmMessages : Form
    {
        public frmMessages()
        {
            InitializeComponent();
        }

        string message;
        int numTimes;

        private void getVars()
        {
            message = txtMessage.Text;
            numTimes = 1;
            if (txtTimes.Text != "")
            {
                numTimes = int.Parse(txtTimes.Text);
            }
        }

        private void showTheMessage(int repeats)
        {
            for (int i = 0; i < repeats; i++)
            {
                MessageBox.Show(message);
            }
        }

        private void btnCustom_Click(object sender, EventArgs e)
        {
            getVars();
            showTheMessage(numTimes);
        }

        private void btnHaka_Click(object sender, EventArgs e)
        {
            getVars();
            message = "Ka Mate!";
            showTheMessage(2);
            message = "Ka ora!";
            showTheMessage(2);
        }

        private void btnAussie_Click(object sender, EventArgs e)
        {
            getVars();
            message = "Aussie!";
            showTheMessage(3);
            message = "Oi!";
            showTheMessage(3);
        }

    }
}
